﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using TheDealmap.Enum;
using TheDealmap.Util;

namespace TheDealmap.Data
{
    [Serializable()]
    public class Business
    {
        private int _activity = 0;
        private CenterdActivity _act;

        /// <summary>
        /// Gets the activity. This value is ignored in serialization.
        /// </summary>
        /// <value>The activity.</value>
        [XmlIgnore]
        public CenterdActivity Activity
        {
            get
            {
                return _act;
            }
        }


        /// <summary>
        /// Gets or sets the activity integer value. This value is an integer for an enum representation please see <see cref="Activity"/> for an enum value.
        /// </summary>
        /// <value>The act.</value>
        [XmlElement("Activity")]
        public int Act
        {
            get { return _activity; }
            set
            {
                _activity = value;
                CFlagsExtracter<CenterdActivity> flager = new CFlagsExtracter<CenterdActivity>(_activity);
                IList<Enum.CenterdActivity> list = flager.aeFlags;
                if (list.Count == 0)
                    _act = CenterdActivity.Unknown;
                else
                    _act = flager.aeFlags.Aggregate((a, b) => a |= b);
            }
        }
        public string AddressLine { get; set; }

        /// <summary>
        /// Gets or sets the capability.
        /// </summary>
        /// <value>The capability.</value>
        public string Capability { get; set; }
        /// <summary>
        /// Gets or sets the category.
        /// </summary>
        /// <value>The category.</value>
        public string Category { get; set; }
        /// <summary>
        /// Gets or sets the city.
        /// </summary>
        /// <value>The city.</value>
        public string City { get; set; }
        /// <summary>
        /// Gets or sets the country.
        /// </summary>
        /// <value>The country.</value>
        public string Country { get; set; }
        /// <summary>
        /// Gets or sets the franchise.
        /// </summary>
        /// <value>The franchise.</value>
        public string Franchise { get; set; }
        /// <summary>
        /// Gets or sets the ID.
        /// </summary>
        /// <value>The ID.</value>
        public string ID { get; set; }
        /// <summary>
        /// Gets or sets the latitude.
        /// </summary>
        /// <value>The latitude.</value>
        public string Latitude { get; set; }
        /// <summary>
        /// Gets or sets the longitude.
        /// </summary>
        /// <value>The longitude.</value>
        public string Longitude { get; set; }
        /// <summary>
        /// Gets or sets the more info link.
        /// </summary>
        /// <value>The more info link.</value>
        public string MoreInfoLink { get; set; }
        /// <summary>
        /// Gets or sets the phone.
        /// </summary>
        /// <value>The phone.</value>
        public string Phone { get; set; }
        /// <summary>
        /// Gets or sets the ratings.
        /// </summary>
        /// <value>The ratings.</value>
        public string Ratings { get; set; }
        /// <summary>
        /// Gets or sets the reviews.
        /// </summary>
        /// <value>The reviews.</value>
        public string Reviews { get; set; }
        /// <summary>
        /// Gets or sets the state.
        /// </summary>
        /// <value>The state.</value>
        public string State { get; set; }
        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        public string Title { get; set; }
    }
}
